package folder.networks;

import java.util.List;

import folder.model.link.Link;
import folder.model.network.Network;
import folder.model.node.Node;

public class TestNetwork
{
	public final Network network;
	
	public TestNetwork()
	{
		network = Network.network();
		
		generateNodes();
		generateLinks();
		connect();
	}
	
	private void generateNodes()
	{
		for( int i = 0; i < 5; i++ )
			network.addNode( Node.node( i, network ) );
	}
	
	private void generateLinks()
	{
		List< Node > nodes = network.getNodes();
		List< Link > links = network.getLinks();
		
		links.add( Link.link( 0, 5,  5, nodes.get( 0 ), nodes.get( 1 ), network ) );
		links.add( Link.link( 1, 5, 10, nodes.get( 0 ), nodes.get( 2 ), network ) );
		//links.add( Link.link( 2, 10,  8, nodes.get( 0 ), nodes.get( 3 ), network ) );
		links.add( Link.link( 3, 5,  3, nodes.get( 1 ), nodes.get( 2 ), network ) );
		//links.add( Link.link( 4, 10,  7, nodes.get( 1 ), nodes.get( 4 ), network ) );
		//links.add( Link.link( 5, 10,  2, nodes.get( 3 ), nodes.get( 4 ), network ) );
	}
	
	private void connect()
	{
		for( Link link: network.getLinks() )
		{
			link.getNodeA().addLink( link );
			link.getNodeB().addLink( link );
		}
	}

}
